const WebpackDevServer = require("webpack-dev-server");
const webpack = require("webpack");
const { getConfig } = require("../config");

class DevServer {
    async setup(options) {
        await this.startServer();
    }
    async startServer() {
        const config = getConfig();
        const compiler = webpack(config);
        this.server = new WebpackDevServer(config.devServer, compiler);
        this.server.start(); // 启动开发服务器
    }
}

module.exports = new DevServer();
